Input Tax Credit is blocked as per section 17(5)(c)
(c) works contract services when supplied for construction of an immovable property (other than plant and machinery) except where it is an input service for further supply of works contract service; &
As per section 17(5)(d)
(d) goods or services or both received by a taxable person for construction of an immovable property (other than plant or machinery) on his own account including when such goods or services or both are used in the course or furtherance of business.
Further explanation is provided
Explanation.––For the purposes of clauses (c) and (d), the expression “construction” includes re-construction, renovation, additions or alterations or repairs,
to the extent of capitalisation, to the said immovable property; So,
Principal Contractor can avail credit in terms of Works contact services availed from subcontractor as it is used for further supply of works contract service and not blocked u/s 17(5)(c)
Principal Contractor or Subcontractor never used goods or services or both on own account Rather they use the same for transferring to employer/Principal contractor Hence ITC not blocked u/s 17(5)(d)
So in all the scenario mentioned by you either the WC services are provided to Government or for commercial or resedential construction ITC is available unless the said supply is exempted