I found an insightful answer by @AviFS in this answer, which explains this well. Here's a key part of their explanation:
Just replace in your .css:
@tailwind base;
@tailwind components;
@tailwind utilities;
with:
@import "tailwindcss";
@config "../../tailwind.config.js";